package com.ruoyi.train.service.impl;

import com.ruoyi.train.domain.JyTrainingSchool;
import lombok.RequiredArgsConstructor;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.ruoyi.train.mapper.JyTrainingSchoolCourseMapper;
import com.ruoyi.train.domain.JyTrainingSchoolCourse;
import com.ruoyi.train.service.IJyTrainingSchoolCourseService;

/**
 * 培训课程信息Service业务层处理
 *
 * @author ruoyi
 * @date 2024-04-03
 */
@Service
@RequiredArgsConstructor
public class JyTrainingSchoolCourseServiceImpl implements IJyTrainingSchoolCourseService {
    private final JyTrainingSchoolCourseMapper jyTrainingSchoolCourseMapper;

    /**
     * 查询培训课程信息
     *
     * @param id 培训课程信息主键
     * @return 培训课程信息
     */
    @Override
    public JyTrainingSchoolCourse selectJyTrainingSchoolCourseById(Long id) {
        return jyTrainingSchoolCourseMapper.selectJyTrainingSchoolCourseById(id);
    }

    /**
     * 查询培训课程信息列表
     *
     * @param jyTrainingSchoolCourse 培训课程信息
     * @return 培训课程信息
     */
    @Override
    public List<JyTrainingSchoolCourse> selectJyTrainingSchoolCourseList(JyTrainingSchoolCourse jyTrainingSchoolCourse) {
        return jyTrainingSchoolCourseMapper.selectJyTrainingSchoolCourseList(jyTrainingSchoolCourse);
    }

    /**
     * 审核培训课程信息
     *
     * @param id      编号
     * @param state   状态
     * @param remarks 备注
     * @return 结果
     */
    @Override
    public int checkTrainingSchoolCourse(Long id, Byte state, String remarks) {
        JyTrainingSchoolCourse jyTrainingSchoolCourse = jyTrainingSchoolCourseMapper.selectJyTrainingSchoolCourseById(id);
        jyTrainingSchoolCourse.setState(state);
        jyTrainingSchoolCourse.setUpdateTime(DateUtils.getNowDate());
        return jyTrainingSchoolCourseMapper.updateJyTrainingSchoolCourse(jyTrainingSchoolCourse);
    }
}
